package com.my.bigsite.modules.sys.web;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.my.bigsite.common.util.UserUtil;
import com.my.bigsite.modules.sys.entity.Menu;
import com.my.bigsite.modules.sys.service.SystemService;

@Controller
public class indexController {
	@Autowired SystemService  systemService;	
	
	@RequestMapping(value = "/sys/index")
	public String index(Model model,HttpSession session) {
		List<Menu>  m=systemService.getMenu();
		model.addAttribute("menuInfo", m);
		
		if(UserUtil.getUserFromSession(session)==null){
			return "redirect:/sys/login";
		}
		String userid=UserUtil.getUserFromSession(session).getId();
		 model.addAttribute("currentuser",userid);
		 model.addAttribute("id", 62);
		 return "modules/sys/index";
	}
	/*
	 * 没权限显示页面
	 */
	@RequestMapping(value = "/denied.shtml")
	public String showAccessDenied(Model model) {
		return "/denied";
	}
}
